

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Going It Alone? A Structural Analysis of Coalition Formation in Elections
%%% run this Matlab script to replicate all tables and figures
%%% (set replication package root folder as working directory)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%% log

diary matlab_log.txt
disp(' ')
disp(['''Going It Alone?...'' Matlab Replication, ',char(datetime('now'))])


%% figures 1, A1, and A3

clear
run('matlab/maps.m')


%% tables 2, 3, A1, A2, A3, and figure A2

clear
run('matlab/descriptive.m')


%% voting stage (tables 4, A4, and figure A4)

clear
run('matlab/voting_stage.m')
run('matlab/spending_plots.m')


%% campaign stage (table 5)

clear
run('matlab/campaign_stage.m')


%% coalition formation stage (table 6 and figure C1)

clear
run('matlab/coalition_stage.m')
run('matlab/coalition_stage_partial_id.m')


%% counterfactuals (table 7 and figure 3)

clear
run('matlab/counterfactuals.m')


%% alternative specifications (tables D1, D2, and D3)

clear
run('matlab/robustness/governors/voting_stage_govs.m')
clear
run('matlab/robustness/governors/coalition_stage_govs.m')

clear
run('matlab/robustness/dropOutliers/voting_stage_dropOutliers.m')
clear
run('matlab/robustness/dropOutliers/coalition_stage_dropOutliers.m')

clear
run('matlab/robustness/IVs/voting_stage_IVs.m')


%%

diary off



